from django.contrib import admin
from .models import *
import xadmin


# Register your models here.
class ProductAdmin(object):
    list_display = ('product_id',
                    'product_name',
                    'product_type',
                    'product_description',
                    'product_img',
                    'product_price',
                    'product_state')
    list_per_page = 20
    ordering = ('product_id',)
    list_display_links = ('product_name',)
    # list_filter = ()
    search_fields = ('product_name',)


class ProductTypeAdmin(object):
    list_display = ('type_id',
                    'type_name')
    list_per_page = 20
    ordering = ('type_id',)
    list_display_links = ('type_id',)
    search_fields = ('type_id', 'type_name',)


class CartAdmin(object):
    list_display = ('user_id',
                    'product_id')
    list_per_page = 20
    ordering = ('user_id',)
    list_display_links = ('user_id',)
    search_fields = ('user_id', 'product_id',)


class DealAdmin(object):
    list_display = ('deal_id',
                    'user_id',
                    'product_id',
                    'deal_timestamp')
    list_per_page = 20
    ordering = ('deal_id',)
    list_display_links = ('deal_id',)
    search_fields = ('user_id', 'product_id',)


class FavoriteAdmin(object):
    list_display = ('favorite_id',
                    'user_id',
                    'product_id')
    list_per_page = 20
    ordering = ('favorite_id',)
    list_display_links = ('favorite_id',)
    search_fields = ('user_id', 'product_id',)


xadmin.site.register(Product, ProductAdmin)
xadmin.site.register(ProductType, ProductTypeAdmin)
xadmin.site.register(Cart, CartAdmin)
xadmin.site.register(Deal, DealAdmin)
xadmin.site.register(Favorite, FavoriteAdmin)